<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>{$current['title']}-{$Think.CONFIG.sitename}</title>

    <link href="__PUBLIC__/static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="__PUBLIC__/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/static/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/static/css/animate.min.css" rel="stylesheet">
    <include file="Public/commoncss" />
    <link rel="stylesheet" href="__PUBLIC__/markdown/css/editormd.css" />
    <!-- Sweet Alert -->
    <link href="__PUBLIC__/static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
</head>

<body class="gray-bg top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom white-bg">
            <include file="Public/header" />
        </div>
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-sm-3">
                    <div class="ibox float-e-margins">
                        <include file="Public/deptnav" />
                    </div>
                </div>
                <div class="col-sm-9 animated fadeInRight">
                    <div class="mail-box-header">
                        <div class="pull-right tooltip-demo">
                            <a href="{:U('index')}" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="" data-original-title="返回列表"><i class="fa fa-reply"></i> 返回列表</a>
                            <a href="javascript:;" class="btn btn-white btn-sm del" data-toggle="tooltip" data-placement="top" title="" data-original-title="删除" val="{$news.id}"><i class="fa fa-trash-o"></i> </a>
                        </div>
                        <h2>
                            查看动态
                        </h2>
                        <div class="mail-tools tooltip-demo m-t-md">

                            <h3>
                                <span class="font-noraml">动态标题： </span>{$news.title}
                            </h3>
                            <h5>
                                <span class="pull-right font-noraml">{$news.time|beenTime}</span>
                                <span class="font-noraml">类型 ：{$news.source|getNewsType}  关联人： </span>{$news.author}
                            </h5>
                        </div>
                    </div>
                    <div class="mail-box">

                    <if condition="$news['type'] neq 2">
                            <div class="mail-body" id="newsView">
                                <textarea style="display:none;" name="editormd-markdown-doc">{$news.content}</textarea>
                            </div>
                            <else />
                            <div class="mail-attachment">
                                <div class="attachment">

                                    <div class="file-box">
                                        <div class="file">
                                            <a href="javascript:;" class="downLoad" path="{$news.content}" fileName="{$news.title|str_replace='分享了文件:','',###}">
                                                <span class="corner"></span>

                                                <div class="icon">
                                                    <i class="fa fa-file"></i>
                                                </div>
                                                <div class="file-name">
                                                    {$news.title|str_replace='分享了文件:','',###}
                                                </div>
                                            </a>
                                        </div>

                                    </div>

                                    <div class="clearfix"></div>
                                </div>
                            </div>
                        </if>
                        <div class="mail-body text-right tooltip-demo">

                            <notempty name="prev">
                                <div class="pull-left">
                                    <a class="btn btn-sm btn-white" href="{:U('view')}?sid={$prev['id']}"><i class="fa fa-arrow-left"></i> 上一页</a>
                                </div>
                            </notempty>
                            <notempty name="next">
                                <div class="pull-right">
                                    <a class="btn btn-sm btn-white" href="{:U('view')}?sid={$next['id']}"><i class="fa fa-arrow-right"></i> 下一页</a>
                                </div>
                            </notempty>
                            <div class="clearfix"></div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public/footer" />
        <iframe id="iframe" src="" style="display: none;"></iframe>
    </div>
</div>
<include file="Public/commonjs" />
<script src="__PUBLIC__/static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="__PUBLIC__/static/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/static/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/markdown/lib/marked.min.js"></script>
<script src="__PUBLIC__/markdown/lib/prettify.min.js"></script>
<script src="__PUBLIC__/markdown/lib/raphael.min.js"></script>
<script src="__PUBLIC__/markdown/lib/underscore.min.js"></script>
<script src="__PUBLIC__/markdown/lib/sequence-diagram.min.js"></script>
<script src="__PUBLIC__/markdown/lib/flowchart.min.js"></script>
<script src="__PUBLIC__/markdown/lib/jquery.flowchart.min.js"></script>
<script src="__PUBLIC__/markdown/editormd.js"></script>
<script src="__PUBLIC__/static/js/plugins/sweetalert/sweetalert.min.js"></script>
<script>
    $(document).ready(function() {
        var newsView;
        newsView = editormd.markdownToHTML("newsView", {
            htmlDecode      : "style,script,iframe",  // you can filter tags decode
            emoji           : true,
            taskList        : true,
            tex             : true,  // 默认不解析
            flowChart       : true,  // 默认不解析
            sequenceDiagram : true,  // 默认不解析
        });
        $('.del').click(function () {
            var data = $(this).attr("val");
            swal({
                title:"您确定删除这个动态吗",
                text: "删除后将不可以恢复！",
                type: "info",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                cancelButtonText:"取消",
                confirmButtonText: "确定",
                closeOnConfirm: false
            }, function () {
                $.post("{:U('del')}",{ids:data},function(data){
                    if(data.status !== 'y'){
                        swal('操作失败!',data.info, "warning");
                    }else{
                        window.location.href="{:U('index')}";
                    }
                });
            });
        });


        //下载文件
        $('.downLoad').click(function(){
            var path = $(this).attr('path');
            var name = $(this).attr('fileName');
            $('#iframe').attr('src',"{:U('Com/downfile')}?path="+path+"&name="+name);
        })

    });
</script>

</body>

</html>